package org.ljj.xml.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.ljj.model.UserModel;
import org.springframework.validation.BindException;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractCommandController;

public class TestAbstractCommonController extends AbstractCommandController {

	public TestAbstractCommonController(){
		setCommandClass(UserModel.class);
	}
	
	
	@Override
	protected ModelAndView handle(HttpServletRequest request,
			HttpServletResponse response, Object command, BindException errors)
			throws Exception {
		
		
		
		// 讲命令对象转为实际对象
		UserModel userModel = (UserModel)command;
		ModelAndView mv = new ModelAndView();
		mv.addObject("user", userModel);
		mv.setViewName("abstractCommand");
		return mv;
	}

}
